package com.finace.money.data;

import com.finace.money.common.Constant;
import com.finace.money.common.util.ParamUtil;
import com.finace.money.data.bean.BaseBean;
import com.finace.money.data.bean.DealRecordListBean;
import com.finace.money.data.http.ApiService;
import com.finace.money.presenter.contract.DealRecordContract;

import java.util.TreeMap;

import io.reactivex.Observable;

/**
 * Created by zhangpeng on 2018/1/27.
 */

public class DealRecordModel implements DealRecordContract.IDealRecordModel {

    public ApiService mApiService;

    public DealRecordModel(ApiService apiService) {
        this.mApiService = apiService;
    }

    @Override
    public Observable<BaseBean<DealRecordListBean>> getDealRecordList(int type,String pagerSize, String pageNumber) {

        TreeMap<String, String> map = new TreeMap<>();
        map.put("pagerSize",pagerSize);
        map.put("pageNumber",pageNumber);
        String url = Constant.dealRecordListInterface;
        switch (type){
            case 0:
                url = Constant.dealRecordListInterface;//攻略
                break;
            case 1:
                url = Constant.newsInterface;//文章列表
                break;
        }
        return mApiService.getList(url, ParamUtil.getParma(map));
    }
}
